<%--
    Document   : sanpham_them
    Created on : Dec 1, 2011, 4:51:44 PM
    Author     : kydrenw
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="box-head">Thêm Sản Phẩm </div>
<form id="frm_add" name="frm_add" method="post" action="sanpham.htm" onsubmit="return check_themsp()" class="infoForm">
    <div class="info">
        <div class="label">Nhóm sản phẩm</div>
        <span>
            <select id="txtDanhMuc" name="txtDanhMuc" onchange="frmChange.submit(); change('txtDanhMuc');" form="frmChange frm_add" value="${sessionScope.txtDanhMuc}">
                <c:forEach var="item" items="${dsDanhMuc}">
                    <option value="${item.ma}">${item.ten}</option>
                </c:forEach>
            </select>
        </span>
    </div>

    <div class="info">
        <div class="label">Loại sản phẩm</div>
        <span>
            <select id="txtLoai" name="txtLoai" value="${sessionScope.txtLoai}" onchange="change('txtDanhMuc');">
                <c:forEach var="item" items="${dsLoaiSP}">
                    <option value="${item.ma}">${item.ten}</option>
                </c:forEach>
            </select>
        </span>
    </div>

    <div class="info">
        <div class="label">Tên sản phẩm</div>
        <span><input id="txtTenSP" name="txtTenSP" type="text" value="${sessionScope.txtTenSP}"/></span>
    </div>

    <div class="info">
        <div class="label">Đơn giá</div>
        <span><input id="txtGia" name="txtGia" type="text" value="${sessionScope.txtGia}"/> $</span>
    </div>

    <div class="info">
        <div class="label">Số lượng trong kho</div>
        <span><input id="txtSoLuong" name="txtSoLuong" type="text" value="${sessionScope.txtSoLuong}"/></span>
    </div>

    <div>
        <div class="label">Miêu tả chi tiết</div>
        <span><textarea id="txtMieuTa" name="txtMieuTa" cols="50" rows="7" value="${sessionScope.txtMieuTa}"></textarea></span>
    </div>

    <div class="info">
        <div class="label">Hỉnh ảnh</div>
        <span><img src="/product/${image}" height="100" width="100"/></span>
        <span>
            <input id="txtImage" type="file" name="txtImage" accept="image/jpeg" form="frmUpload" value="${image}"/>
            <input type="submit" value="Upload File" form="frmUpload"/>
        </span>
    </div>

    <div class="message">${message}</div>
    <div class="command">
        <span><input type="hidden" name="action" value="sanpham_them_submit"/></span>
        <span><input type="hidden" name="image" value="${image}"/></span>
        <span><input type="submit" name="add" value="Thêm" class="button"/></span>
        <span><input type="button" name="back" value="Quay lại" class="button" onclick="window.location='sanpham.htm';"/></span>
    </div>
</form>

<form action="uploadimage.jsp" enctype="multipart/form-data" method="post" id="frmUpload" onsubmit="return mapValue();">
</form>

<form action="sanpham.htm" method="post" id="frmChange" name="frmChange">
    <input type="hidden" name="action" value="them"/>
</form>
